/*
 * @Description: 认证
 * @Author: franktrue 807615827@qq.com
 * @Date: 2021-08-02 08:42:42
 * @LastEditTime: 2021-08-02 10:23:25
 */
package service

import (
	"errors"
)

type AuthRequest struct {
	AppKey    string `form:"app_key" binding:"required"`
	AppSecret string `form:"app_secret" binding:"required"`
}

func (service *Service) CheckAuth(param *AuthRequest) error {
	auth, err := service.dao.GetAuth(param.AppKey, param.AppSecret)
	if err != nil {
		return err
	}
	if auth.ID > 0 {
		return nil
	}
	return errors.New("auth info does not exist")
}
